package studentsinfomanagement.bean;

import java.util.Objects;

/**
 * 课程类
 *
 */
public class Course {
    private String name;//课程名
    private String cno;//课程号
    private String tno;//授课老师
    private int score;//学分

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCno() {
        return cno;
    }

    public void setCno(String cno) {
        this.cno = cno;
    }

    public String getTno() {
        return tno;
    }

    public void setTno(String tno) {
        this.tno = tno;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    /**
     * 课程号+授课老师教工号是区分一门课程的码
     * @param o
     * @return
     */
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Course course = (Course) o;
        return cno.equals(course.cno) &&
                tno.equals(course.tno);
    }

    @Override
    public int hashCode() {
        return Objects.hash(cno, tno);
    }
}
